/**
 * 默认加载
 * @type {{init: Window.process.init, public: Window.process.public}}
 */
window.process = {
    init: function () {
        this.initData();
        this.public();
    },
    initData:function () {
        if(localStorage.token){
            var cardInfo=JSON.parse(localStorage.getItem('cardInfo'))
            $('.user .name').html(cardInfo.username)
            $('.user .phone').html(cardInfo.phone)
            if(cardInfo.headImgUrl){
                $('.user .icon img').attr('src',cardInfo.headImgUrl)
            }
        }else{
            $.alert({
                title: '提示',
                text: '你暂无登录，请先登录！',
                onOK: function () {
                    window.location.href="../login/index.html";
                }
            });

        }


    },
    public: function () {
       //退出登录
        $('#leave').click(function () {
            localStorage.removeItem('token');
            window.location.href="../login/index.html";
        })

    }
};

/**
 * 启动方法执行
 */
process.init();



